﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using HotelSoftBusLib;

namespace WebServiceTest
{
    class Program
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                Thread thread = new Thread(new ThreadStart(GetWebServiceMethod));
                thread.Start();
                Thread thread1 = new Thread(new ThreadStart(GetWebServiceMethod1));
                thread1.Start();
                Thread thread2 = new Thread(new ThreadStart(GetWebServiceMethod2));
                thread2.Start();
                //Console.ReadKey();
                Thread.Sleep(10000);
            }
        }

        static void GetWebServiceMethod()
        {
            DeviceService.DeviceServiceSoapClient client = new DeviceService.DeviceServiceSoapClient();
            Customer customer = new Customer();
            Room room = new Room();
            Operators operators = new Operators();
            string opertime = "20140306120425";
            customer.Name = "zhangsan";
            customer.Number = "1234567";
            room.House = "7";
            room.Number = "3456";
            operators.Name = "lisi";
            operators.Number = "123456";
            string CusStr = Newtonsoft.Json.JsonConvert.SerializeObject(customer);
            string RomStr = Newtonsoft.Json.JsonConvert.SerializeObject(room);
            string OprStr = Newtonsoft.Json.JsonConvert.SerializeObject(operators);
            string retStr = client.CheckIn(CusStr, RomStr, opertime, OprStr);
            //string retStr1 = client.CheckOut(CusStr, RomStr, opertime, OprStr);
            //string retStr2 = client.MakeVIPCard(CusStr, opertime, OprStr);
            Console.WriteLine(retStr);
            //Console.WriteLine(retStr1);
        }

        static void GetWebServiceMethod1()
        {
            DeviceService.DeviceServiceSoapClient client = new DeviceService.DeviceServiceSoapClient();
            Customer customer = new Customer();
            Room room = new Room();
            Operators operators = new Operators();
            string opertime = "20140306120425";
            customer.Name = "zhangsan";
            customer.Number = "1234567";
            room.House = "7";
            room.Number = "3456";
            operators.Name = "lisi";
            operators.Number = "123456";
            string CusStr = Newtonsoft.Json.JsonConvert.SerializeObject(customer);
            string RomStr = Newtonsoft.Json.JsonConvert.SerializeObject(room);
            string OprStr = Newtonsoft.Json.JsonConvert.SerializeObject(operators);
            //string retStr = client.CheckIn(CusStr, RomStr, opertime, OprStr);
            string retStr1 = client.CheckOut(CusStr, RomStr, opertime, OprStr);
            //string retStr2 = client.MakeVIPCard(CusStr, opertime, OprStr);
            //Console.WriteLine(retStr);
            Console.WriteLine(retStr1);
        }

        static void GetWebServiceMethod2()
        {
            DeviceService.DeviceServiceSoapClient client = new DeviceService.DeviceServiceSoapClient();
            Customer customer = new Customer();
            //Room room = new Room();
            Operators operators = new Operators();
            string opertime = "20140306120425";
            customer.Name = "zhangsan";
            customer.Number = "1234567";
            //room.House = "7";
            //room.Number = "3456";
            operators.Name = "lisi";
            operators.Number = "123456";
            string CusStr = Newtonsoft.Json.JsonConvert.SerializeObject(customer);
            //string RomStr = Newtonsoft.Json.JsonConvert.SerializeObject(room);
            string OprStr = Newtonsoft.Json.JsonConvert.SerializeObject(operators);
            //string retStr = client.CheckIn(CusStr, RomStr, opertime, OprStr);
            //string retStr1 = client.CheckOut(CusStr, RomStr, opertime, OprStr);
            string retStr2 = client.MakeVIPCard(CusStr, opertime, OprStr);
            Console.WriteLine(retStr2);
        }
    }
}
